package cn.stazxr.deepseekchat.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.core.Ordered;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * "/" to "swagger-ui/index.html"
 *
 * @author talentestors
 * @version 1.0
 * @since 2025.3.15
 */
@Configuration
public class IndexViewConfig implements WebMvcConfigurer {

	@Override
	public void addViewControllers(ViewControllerRegistry registry) {
		// 设置访问路径为 “/” 路径时，跳转到 "/swagger-ui/index.html"
		registry.addViewController("/").setViewName("redirect:/swagger-ui/index.html");
		// 设置最高优先级
		registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
	}

}
